/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.ecommerce.erro;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author rpateixeira
 */
public class ExceptionList extends Exception {
    private List<Exception> listaErros = new ArrayList<Exception>();

	public List<Exception> getListaErros() {
		return listaErros;
	}

	public void add(final Exception exception){
		getListaErros().add(exception);
	}

	@Override
	public String getMessage() {
		StringBuilder retorno = new StringBuilder("");
		for (Exception e : getListaErros())
			retorno.append(e.getMessage()).append("\n");
		return retorno.toString();
	}
}
